package com.office.supplies.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageInfo;
import com.office.supplies.pojo.Notice;
import com.office.supplies.service.NoticeService;
import com.office.supplies.mapper.NoticeMapper;
import org.springframework.stereotype.Service;

/**
 * @author LENOVO
 * @description 针对表【notice】的数据库操作Service实现
 * @createDate 2025-05-08 14:03:41
 */
@Service
public class NoticeServiceImpl extends ServiceImpl<NoticeMapper, Notice>
        implements NoticeService {

    @Override
    public PageInfo<Notice> getNoticeList(Integer pageNum, Integer pageSize) {
        Page<Notice> page = new Page<>(pageNum, pageSize);
        page = page(page,
                new LambdaQueryWrapper<Notice>()
                        .orderBy(true, false, Notice::getCreateTime)
        );
        if (page != null) {
            return new PageInfo<>(page.getRecords());
        }
        return null;
    }
}




